declare var tt;
declare var wx;

import { _decorator, Component, Node } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('DataManager')
/**
 * 数据管理
 */
export class DataManager {

    //游戏名称
    private GameName: string = "BasketBallGame_";

    private constructor() { }

    /** 单例实例 */
    public static readonly instance: DataManager = new DataManager();

    /**
     * 清除缓存
     */
    public ClearStorage(_key: string) {
        localStorage.removeItem(this.GameName + _key);
    }

    /**
     * 更新本地缓存
     */
    public SetStorage(_key: string, _value: any) {
        localStorage.setItem(this.GameName + _key, JSON.stringify(_value));

    }

    /**
     * 获取本地缓存
     */
    public GetStorage(_key: string) {
        return JSON.parse(localStorage.getItem(this.GameName + _key));
    }

}

export const dataManager = DataManager.instance;
